<extend name="public/base"/>
<block name="body">
<div class="layui-card qn-header">
	<div class="layui-breadcrumb">
		<a href="">首页</a>
		<a href="">云市场应用自动升级</a>
		<a href=""><cite>即将升级的扩展</cite></a>
	</div>
</div>
<div class="layui-fluid">
	<div class="layui-card">
	<div class="layui-card-body">
	
<style>
.content-wrapper {
	float:left;
}
.cover-wrapper .cover-icon {
    width: 60px;
    height: 60px;
    text-align: center;
    background: #fff;
    border-radius: 10px;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
    display: inline-block;
	border:none;
	border:1px solid #f1f1f1;
}
.cover-wrapper {
    width: 60px;
    margin-right: 15px;
    float: left;
}
.thumbnail{
	position:relative;
    padding: 10px;
	min-height:44px; 
	overflow:hidden;
	width:50%;
	float:left;
	box-sizing: border-box;
}
.cover-wrapper .cover-icon i {
    font-size: 64px;
    line-height: 120px;
    color: white;
}
.content-wrapper .bottom-btns {
    margin-top: 10px;
}
.content-wrapper .title a {
    font-size: 14px;
    color: #333;
}
.content-wrapper .title{
    margin-bottom:0;
}
h3{padding:10px 0; line-height:25px; height:25px; clear:both}
.module-list{overflow:hidden;}
.zk{border: 1px solid red; border-radius:5px; color: red; padding:2px; height:20px; line-height:20px}
</style>
<div class="with-padding" id="version_list">
	<div class="module-list layui-elem-quote layui-quote-nm">
		<volist name="modules" id="vo">
			<div class="thumbnail">
				<div class="cover-wrapper">
					<div style="position:relative; border-radius: 16px; -moz-border-radius: 16px; -webkit-border-radius: 16px;">
						<img src=".{$vo.path}/preview.jpg" alt="{$vo.name}" class="cover-icon" style="width:100%;">
					</div>
				</div>
				<div class="content-wrapper">
					<div class="title">
						<a href="{:U('config',array('id'=>$vo['id']))}" class="" title="{$vo.title}（{$vo.name}），{$vo.description}，{$vo.author}">{$vo.title}</a>
						<empty name="vo['token']">
							<span class="layui-btn layui-btn-xs layui-btn-primary" style="">本地</span>
							<else/>
							<span class="layui-btn layui-btn-xs layui-btn-primary" style="">云</span>
						</empty>
						<empty name="vo['update_list']">
							<empty name="vo['token']">
								<span class="layui-btn layui-btn-xs layui-btn-primary">{$vo.version}</span>
							<else/>
								<span class="layui-btn layui-btn-xs layui-btn-primary">{$vo.version_info.version}</span>
							</empty>
							<else/>
							<php>$vt = version_compare($vo['version'],$vo['update_list'][0]['version']);
							if($vt < 0){</php>
								<span class="layui-btn layui-btn-xs layui-btn-primary">有新版{$vo.update_list.0.version}</span>
							<php>}else{</php>
								<span class="layui-btn layui-btn-xs layui-btn-primary">{$vo.version}</span>
							<php>}</php>
						</empty>
					</div>
					<div class="" style="position:relative;">
						<empty name="vo['update_list']">
							<else/>
							<php>$vt = version_compare($vo['version'],$vo['update_list'][0]['version']);
							if($vt < 0){</php>
								<a target="_blank" href="{:appstoreU('Appstore/Index/goodsDetail',array('token'=>$vo['token']))}" class="layui-btn layui-btn-xs layui-btn-primary">查看</a>
							<php>}else{</php>
								<a target="_blank" href="{:appstoreU('Appstore/Index/goodsDetail',array('token'=>$vo['token']))}" class="layui-btn layui-btn-xs layui-btn-primary">查看</a>
							<php>}</php>
							
						</empty>
					</div>
				</div>
			</div>
		</volist>
	</div>
	<empty name="versionList">

		<div class="">
			已经是最新版本了哟。
		</div>

	<else/>
		<div class="">
			<p>当前最新可升级版本号：<strong>{$versionList.0.version}</strong></p>

			<p>当前版本号：<strong>{$modules.0.version}</strong></p>
		</div>
		
		<h3>可以升级的版本</h3>
		<table class="layui-table" lay-skin="line">
			<thead>
			<tr>
				<th style="width: 80px">版本号</th>
				<th style="width: 150px">发布时间</th>
				<th>更新日志</th>
				<th>操作</th>
			</tr>
			</thead>
			<volist name="versionList" id="vo">
				<tr>
					<td>{$vo.version}</td>
					<td>{$vo.create_time|friendlyDate}</td>
					<td>{$vo.version_desc|formatLog}</td>
					<td>
					<php>
					$vt = 0;
					$vt = version_compare($vo['version'],$modules[0]['version']);
					if($vt > 0){
					</php>
						<a href="{:U('Updating1',array('version_id'=>$vo['token']))}" class="layui-btn layui-btn-sm">开始升级</a>
					<php>}elseif($vt == 0){</php>
						当前版本
					<php>}else{</php>
						历史版本
					<php>}</php>
					</td>
				</tr>
			</volist>
		</table>
	</empty>
</div>
</div>
</div>
</div>

<script>
	function writeMessage($data) {
		$('#message').append($data);
	}
	function replaceMessage($data) {
		$('#message').children().last().remove();
		$('#message').children().last().remove();
		$('#message').append($data);
	}
	var progress = {
		'show': function () {
			$('#progress').parent().show();
		},
		'setValue': function ($value) {
			$('#progress').css('width', $value);
		},
		'hide': function () {
			$('#progress').parent().hide();
		}
	}
</script>
</block>